package com.example.hello.mapper;

import com.example.hello.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface UserMapper {
  User selectById(Long userId);

  User selectByUsername(@Param("username") String username);

  User selectByEmail(String email);

  User selectByPhone(String phone);

  User selectByEmailAndPhone(@Param("email") String email, @Param("phone") String phone);

  List<User> selectUserList(User user);

  int insertUser(User user);

  int updateUser(User user);

  int updatePassword(@Param("userId") Long userId, @Param("newPassword") String newPassword);

  int updateStatus(@Param("userId") Long userId, @Param("status") Integer status);

  int updateVerificationCode(@Param("userId") Long userId, @Param("verificationCode") String verificationCode);

  int resetPasswordByEmailAndCode(@Param("email") String email, 
                                 @Param("verificationCode") String verificationCode, 
                                 @Param("newPassword") String newPassword);

  int deleteById(Long userId);
}